package com.kly.enums;

/**
 * 商品类型: 1-消耗类 2-订阅类
 * @author linqu
 */
public enum PurchaseType {
    ONCE_PRODUCT(1, "ONCE_PRODUCT"),
    SUBSCRIPTION_PRODUCT(2, "SUBSCRIPTION_PRODUCT"),

    ;
    private Integer type;
    private String description;

    PurchaseType(Integer type, String description) {
        this.type = type;
        this.description = description;
    }

    public static PurchaseType fromType(Integer status) {

        for (PurchaseType orderStatus : values()) {
            if (orderStatus.getType().equals(status)) {
                return orderStatus;
            }
        }
        return null;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}
